var paras={};
$.ajaxPrefilter( "json script", function( options ) {
    options.crossDomain = true;
});

function showMsg(str){
	alert(str);
	//window.js2java.al(str);
	}

function chklogined(){
	if(typeof(window.localStorage.islogin)=="undefined"||window.localStorage.islogin==null||window.localStorage.islogin=="false"||!window.localStorage.islogin){
		showMsg("请先登录！");
		window.location.href="login.html";
		return;
		}
	}

function fujin(stringloc){
	var lat=stringloc.split('|')[0];
	var lng=stringloc.split('|')[1];
	$.ajax({
		type:"GET",
		url:"http://client.jiaduokang.com/company/read?lat="+lat+"&lng="+lng,
		dataType:"jsonp",
		data:"{'lat':'40.056986','lng':'116.419846'}",
		//jsonpCallback:"jdkjsonp",		
		jsonp : "jsonp_callback",
		timeout: 5000,
		success:function(data, status){
		  var strbystorelist="<li><a href='#fujinyaodianshow?upara={bystoreid:\"qiye\"}'>北京异世界科技有限公司</a><span class='dis'>推荐</span></li><li><a href='#fujinyaodianshow?upara={bystoreid:\"yaodian\"}'>国医国药大药房</a><span class='dis'>推荐</span></li>";
		  if(data!=null){
			  data=data["msg"];
			  var lendata;
		  for(i=0;lendata=data.length,i<lendata;i++){
			  var distance=data[i]["distance"];
			  var distxt="";
			  distxt=(distance/1000).toString().substring(0,3);
			  
			  strbystorelist+="<li><a href='#fujinyaodianshow?upara={\"bystoreid\":\""+data[i]["username"]+"\"}'>"+data[i]['company']+"</a><span class='dis'></span></li>";
			  }
		  }
		  else{strbystorelist="暂无附近药店数据"}
		  $("#ulbystorelist").html(strbystorelist);
		},
		error:function(XHR, textStatus, errorThrown){
		   $("#ulbystorelist").html("网络不给力，加载未完成!")
		   console.log(textStatus+"\n"+errorThrown);
		}		
	})	
}

$( document ).on( "pageinit", "#bystorelist", function() {
	//window.js2java.Loc();	
	fujin("40.056986|116.419846");
})


$( document ).on( "pageinit", "#comlist", function() {
	jdkajp("http://client.jiaduokang.com/company/category",getcomlist);	
})
function getcomlist(result){
	var strcomlist="";
	if(1==result["status"]){
		result=result.msg;
		for(var i=0,len=result.length;i<len;i++){
			strcomlist+="<dt>"+result[i].catname+"</dt><dd>";
			var resultsub=result[i]["son"];
			for(var j=0,lensub=resultsub.length;j<lensub;j++){
				strcomlist+="<a href='#comsublist?upara={\"catid\":"+resultsub[j]["catid"]+"}'>"+resultsub[j]["catname"]+"</a>"
			}
			strcomlist+="</dd>";
		}
		$(".dlcomlist").html(strcomlist);

	}
}

$( document ).on( "pagebeforeshow", "#comsublist", function() {
	if(paras.length>0){
		var jparas=eval("("+unescape(paras)+")");
		var catid=jparas["catid"];
		jdkajp("http://client.jiaduokang.com/company/read?catid="+catid,getcomsublist);	
	}
})
function getcomsublist(result){
	var strcomlist="";
	if(1==result["status"]){
		result=result.msg;
		for(var i=0,len=result.length;i<len;i++){
			strcomlist+="<li><a href='#"+(parseInt(result[i]["catid"].replace(',',''))>28?"fujinyishengshow":"fujinyaodianshow")+"?upara={\"username\":\""+result[i]["username"]+"\"}'>"+result[i].company+"</a><span class='dis'></span></li>";
			
		}
		$("#ulcomsublist").html(strcomlist);
	}
	else{
		$("#ulcomsublist").html("暂无数据");
	}
}


$( document ).on( "pageinit", "#loginpage", function() {
	if(window.localStorage.islogin=="true"){window.location.href="index.html"}
	$("#btnlogin").click(function(){
		$(this).attr("disabled","disabled").val("登录中...");
		var louser=$("#lousername").val().replace(/\s+/g,"");
		var lopas=$("#lopassword").val().replace(/\s+/g,"");
		if(louser.length<6||louser.length>20){showMsg("用户名为6-20位的字母或数字！")}
		if(lopas.length<6||lopas.length>20){showMsg("密码长度应为6-20位！")}
		$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/member/login?username="+louser+"&password="+lopas,
			dataType:"jsonp",
			//jsonpCallback:"jdkjsonp",
			jsonp : "jsonp_callback",
			data:{"username":louser,"password":lopas},
			timeout:5000,
			success: function(data,status){
				if(data!=null){
					var status=data["status"];
					var msg=data["msg"];
					if(status==1){
						window.localStorage.user=louser;
						window.localStorage.islogin=true;
						window.localStorage.uid=data["msg"]["userid"];
						window.localStorage.company=data["msg"]["company"];

						showMsg("登录成功!");
						$("#btnlogin").val("登 录").removeAttr("disabled");
						window.location.href="index.html";
						}
					else{
						showMsg("登录失败");
						$("#btnlogin").val("登 录").removeAttr("disabled");
						}
					}
				}
			,error:function(XHR, textStatus, errorThrown){
				   console.log(textStatus+"\n"+errorThrown);
				   $("#btnlogin").val("登 录").removeAttr("disabled");
				}	
			})
		})

	
})


$( document ).on( "pageinit", "#reg", function() {
	$(".reggroupdd span").click(function(){		
		$(this).addClass("on").siblings("span").removeClass("on");
		$("#reggroupid").val($(this).attr("data-groupid"));
		if($(this).hasClass("comp")){
			$(".compele").show();
		}
		else{
			$(".compele").hide();
		}
	})

	jdkajp("http://client.jiaduokang.com/member/getcat",fnbindregcat);

	$("#btnreg").click(function(){
		$(this).attr("disabled","disabled").val("注册...");
		var reguser=$("#regusername").val().replace(/\s+/g,"");
		var regpas=$("#regpassword").val().replace(/\s+/g,"");
		var regrepas=$("#regrepassword").val().replace(/\s+/g,"");
		var regemail=$("#regemail").val().replace(/\s+/g,"");
		var regtruename=$("#regtruename").val().replace(/\s+/g,"");
		var regcompany=$("#regcompany").val().replace(/\s+/g,"");
		var regcatid=$("#regcatid").val().replace(/\s+/g,"");
		var reggroupid=$("#reggroupid").val().replace(/\s+/g,"");
		if(reguser.length<6||reguser.length>20){showMsg("用户名为6-20位的字母或数字！");$("#btnreg").val("注 册").removeAttr("disabled");return;}
		if(regpas.length<6||regpas.length>20){showMsg("密码长度应为6-20位！");$("#btnreg").val("注 册").removeAttr("disabled");return;}
		if(regpas!=regrepas){showMsg("两次密码不一致，请重新输入！");$("#btnreg").val("注 册").removeAttr("disabled");return;}

		jdkajp("http://client.jiaduokang.com/member/register?username="+reguser+"&password="+regpas+"&email="+regemail+"&truename="+regtruename+"&groupid="+reggroupid+"&company="+regcompany+"&catid="+regcatid,fnregsuc);

	})
})

function fnbindregcat(result){
	var stroption="";
	if(1==result["status"]){
		result=result.msg
		$.each(result,function(i,v){
			stroption+="<option value=\""+i+"\">"+v+"</option>";
		})
		$("#regcatid").html(stroption);
	}

	
}

function fnregsuc(result){
	if(result!=null){
		var status=result["status"];
		var msg=result["msg"];
		
		if(status==1){
			window.localStorage.user=$("#regusername").val().replace(/\s+/g,"");
			window.localStorage.islogin=true;
			showMsg("注册成功!");
			$("#btnreg").val("注 册").removeAttr("disabled");
			window.location.href="index.html";
			}
		else{
			showMsg("注册失败！");
			$("#btnreg").val("注 册").removeAttr("disabled");
			}
		}
}

$( document ).on( "pageinit", "#regpage", function() {
	if(window.localStorage.islogin=="true"){window.location.href="index.html"}
	$("#btnreg").click(function(){
		$(this).attr("disabled","disabled").val("注册...");
		var reguser=$("#regusername").val().replace(/\s+/g,"");
		var regpas=$("#regpassword").val().replace(/\s+/g,"");
		var regrepas=$("#regrepassword").val().replace(/\s+/g,"");
		var regemail=$("#regemail").val().replace(/\s+/g,"");
		if(reguser.length<6||reguser.length>20){showMsg("用户名为6-20位的字母或数字！");$("#btnreg").val("注 册").removeAttr("disabled");return;}
		if(regpas.length<6||regpas.length>20){showMsg("密码长度应为6-20位！");$("#btnreg").val("注 册").removeAttr("disabled");return;}
		if(regpas!=regrepas){showMsg("两次密码不一致，请重新输入！");$("#btnreg").val("注 册").removeAttr("disabled");return;}
		$.ajax({
			type:"GET",
			url:"http://api.jiaduokang.com/member/register?username="+reguser+"&password="+regpas+"&repassword="+regrepas+"&email="+regemail,
			dataType:"jsonp",
			data:{"username":reguser,"password":regpas,"email":regemail},
			timeout:5000,
			success: function(data,status){
				if(data!=null){
					var status=data["status"];
					var msg=data["msg"];
					
					if(status==1){
						window.localStorage.user=reguser;
						window.localStorage.islogin=true;
						showMsg("注册成功!");
						$("#btnreg").val("注 册").removeAttr("disabled");
						window.location.href="index.html";
						}
					else{
						showMsg("注册失败！");
						$("#btnreg").val("注 册").removeAttr("disabled");
						}
					}
				},
			error:function(XHR, textStatus, errorThrown){
				   console.log(textStatus+"\n"+errorThrown);
				}	
			})
		})
})


//fujinyaodianshow	
$( document ).on( "pagebeforeshow", "#fujinyaodianshow", function() {	

	 if(paras.length>0){

		 var jparas=eval("("+unescape(paras)+")");
		 var bystoreid=jparas["username"];
		 window.localStorage.bystoreid=bystoreid;
		 var storename=""
		 
		 $.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/company/read?username="+bystoreid,
			dataType:"jsonp",
			//jsonpCallback:"jdkjsonp",
			jsonp : "jsonp_callback",
			data:"{'bystoreid':"+bystoreid+"}",
			data:"",
			timeout: 5000,
			success:function(data){
			  if(data!=null){
				 var data=data["msg"];
				 storename=data["name"];
			  	$("#fujinyaodianshow .yaodianban h1").html(data["company"]);
				
				
				
				$("#fujinyaodianshow .shopfav").html("<div class=\"name\">"+data["company"]+"</div><div class=\"num\"><span>292</span>关注者</div><a href=\"\" id=\"afav\" class=\"fav\">关注</a>")
				$("#fujinyaodianshow #afav").on("click",function(){
				console.log("点了");
				chklogined();
				$.ajax({
					type:"GET",
					url:"http://api.jiaduokang.com/attention/add?uid="+window.localStorage.uid+"&id="+window.localStorage.bystoreid+"&target=drugstore",
					dataType:"jsonp",
					jsonp : "jsonp_callback",
					//jsonpCallback:"jdkjsonp",
					//data:{'uid':window.localStorage.uid,'bystoreid':window.localStorage.bystoreid,'target':'drugstore'},
					data:"",
					timeout: 5000,
					success:function(data){
						if(data!=null){
							var status=data["status"];
							var msg=data["msg"];
							if(status==1){
								$("#fujinyaodianshow #afav").html($("#fujinyaodianshow #afav").html()=="已关注"?"关注":"已关注");
								showMsg(msg);
								}
							else{
								$("#fujinyaodianshow #afav").html($("#fujinyaodianshow #afav").html()=="已关注"?"关注":"已关注");
								showMsg(msg);
								}
							}
					  
					},
					error:function(XHR, textStatus, errorThrown){
					   console.log(textStatus+"\n"+errorThrown);
					}	
					})
				})	
						
				
				
				
			  }
			  else{strbystorelist="数据错误"}
			  
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyaodianshow .yaodianban h1").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
		
		$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/video/lists?username="+bystoreid,
			dataType:"jsonp",
			jsonp : "jsonp_callback",
			//jsonpCallback:"jdkjsonp",
			//data:"{'username':"+bystoreid+"}",
			data:"",
			success:function(result){

				if(result["status"]==1){	

					if(result["msg"].length>1){$(".avideolist").html("往期视频就医").attr('href','#videolist?upara={\"username\":\"'+bystoreid+'\"}')}
						else{$(".avideolist").html("").attr('href','')}				
					result=result["msg"][0];

					$(".syvd").html("<em>主题：</em><p>"+result["title"]+"</p><em>简介：</em><p>"+result["introduce"]+"</p><em>日期：</em><p>"+result["startdate"]+"</p><p><input type=\"button\" onclick=\"window.js2java.toPlayLive('"+result["itemid"]+"','"+window.localStorage.user+"|0')\" value=\"观看直播\"></p>");
				}
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyaodianshow .ulprolist").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}	
		})
		
		// $.ajax({
		// 	type:"GET",
		// 	url:"http://api.jiaduokang.com/event/lists",
		// 	dataType:"jsonp",
		// 	data:"{'bystoreid':"+bystoreid+"}",
		// 	timeout: 5000,
		// 	success:function(data, status){
				
		// 	  var strbystorelist="";
			  
		// 	  if(data!=null){
		// 		  data=data["msg"];
		// 		  var lendata;
		// 	  	  for(i=0;lendata=data.length,i<lendata;i++){
		// 		  strbystorelist+="<li><a href='#fujinyaodianyouhui?upara={yhid:"+data[i]["id"]+"}'>"+data[i]['title']+"</a></li>";
		// 		  }
		// 	  }
		// 	  else{strbystorelist="暂无数据"}
		// 	  $("#fujinyaodianshow .ulshopyh").html(strbystorelist);
			  
		// 	},
		// 	error:function(XHR, textStatus, errorThrown){
		// 	   $("#fujinyaodianshow .ulshopyh").html("网络不给力，加载未完成!")
		// 	   console.log(textStatus+"\n"+errorThrown);
		// 	}		
		// })	
		
		
		
		$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/mall/read?username="+bystoreid,
			dataType:"jsonp",
			//jsonpCallback:"jdkjsonp",
			jsonp : "jsonp_callback",
			data:"{'bystoreid':"+bystoreid+"}",
			timeout: 5000,
			success:function(data, status){
				
			  var strbystorelist="";
			  
			  if(data!=null && 1==data["status"]){
				  data=data["msg"];
				  var lendata;
			  	  for(i=0,lendata=data.length;i<lendata;i++){
			  	  	  
					  var picurl="img.png";
					  if(data[i]["thumb"].length>0){
						  picurl=data[i]["thumb"];
						  }
					  
				  strbystorelist+="<li><a href='#fujinyaodianproshow?upara={\"prouser\":\""+bystoreid+"\",\"proid\":"+data[i]["itemid"]+"}'><img class='pic' src='"+picurl+"'><div class='name'>"+data[i]["title"]+"<em>"+data[i]["introduce"]+"</em></div><div class='jiage'>价格：<span class='num'>￥"+data[i]["pricepurchase"]+"</span> 规格"+data[i]["spec"]+"</div></a></li>";
				  
				  
				  }
			  }
			  else{strbystorelist="暂无数据"; }
			  $("#fujinyaodianshow .ulprolist").html(strbystorelist);
			  
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyaodianshow .ulprolist").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
		
		
	 
	}
	
	
})



//fujinyaodianprolist
//$( document ).on( "pagebeforeshow", "#fujinyaodianprolist", function() {	
//	 if(paras.length>0){
//		 var jparas=eval("("+unescape(paras)+")");
//		 var uid=jparas["uid"];		
//		 var cateid=jparas["cateid"];
//		
//		$.ajax({
//			type:"GET",
//			url:"http://api.jiaduokang.com/product/lists?uid="+uid+"&cateid="+cateid,
//			dataType:"jsonp",
//			data:"{'uid':"+uid+",'cateid':"+cateid+"}",
//			timeout: 5000,
//			success:function(data, status){
//				
//			  var strbystorelist="<div class=\"ch proch\"><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':1}\" cateid=\"1\" class=\"on\">专科用药</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':2}\" cateid=\"2\">营养保健</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':3}\" cateid=\"3\">医疗器械</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':4}\" cateid=\"4\">其他</a></div>";
//			  
//			  if(data!=null){
//				  data=data["msg"];
//				  strbystorelist+="<ul class=\"ulprolist\">"
//				  var lendata;
//			  	  for(i=0;lendata=data.length,i<lendata;i++){
//					  
//					  var picurl="images/img.png";
//					  if(data[i]["pic"].length>0){
//						  picurl=data[i]["pic"][0];
//						  }
//					  
//				  strbystorelist+="<li><a href='#fujinyaodianproshow?upara={proid:"+data[i]["id"]+"}'><img class='pic' src='"+picurl+"'><div class='name'>"+data[i]["name"]+"<em>"+data[i]["desc"]+"</em></div><div class='jiage'>价格：<span class='num'>￥"+data[i]["price_sell"]+"</span> 规格"+data[i]["spec"]+"</div></a></li>";
//				  
//				  
//				  }
//				  strbystorelist+="</ul>";
//			  }
//			  else{strbystorelist="暂无数据"}
//			  $("#fujinyaodianprolist .maincon").html(strbystorelist);
//			  $("#fujinyaodianprolist .proch a").on("click",function(){
//				  
//				  if(!$(this).hasClass("on")){
//					  	$(this).addClass("on").siblings().removeClass("on");
//					  	$.ajax({
//							type:"GET",
//							url:"http://api.jiaduokang.com/product/lists?uid="+uid+"&cateid="+$(this).attr("cateid"),
//							dataType:"jsonp",
//							data:"{'uid':"+uid+",'cateid':"+cateid+"}",
//							timeout: 5000,
//							success:function(data, status){
//								
//							  var strbystorelist="";
//							  
//							  if(data!=null){
//								  data=data["msg"];
//								  var lendata;
//								  for(i=0;lendata=data.length,i<lendata;i++){
//									  
//									  var picurl="images/img.png";
//									  if(data[i]["pic"].length>0){
//										  picurl=data[i]["pic"][0];
//										  }
//									  
//								  strbystorelist+="<li><a href='#fujinyaodianproshow?upara={proid:"+data[i]["id"]+"}'><img class='pic' src='"+picurl+"'><div class='name'>"+data[i]["name"]+"<em>"+data[i]["desc"]+"</em></div><div class='jiage'>价格：<span class='num'>￥"+data[i]["price_sell"]+"</span> 规格"+data[i]["spec"]+"</div></a></li>";
//								  }
//								  
//							  }
//							  else{strbystorelist="暂无数据"}
//							  $("#fujinyaodianprolist .ulprolist").html(strbystorelist);
//							  
//							},
//							error:function(XHR, textStatus, errorThrown){
//							   $("#fujinyaodianprolist .maincon").html("网络不给力，加载未完成!")
//							   console.log(textStatus+"\n"+errorThrown);
//							}		
//						})	
//					  }
//				  })
//			},
//			error:function(XHR, textStatus, errorThrown){
//			   $("#fujinyaodianprolist .maincon").html("网络不给力，加载未完成!")
//			   console.log(textStatus+"\n"+errorThrown);
//			}		
//		})	
//				 
//	}
//})

$( document ).on( "pagebeforeshow", "#fujinyaodianprolist", function() {	
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var uid=jparas["uid"];		
		 var cateid=jparas["cateid"];
		
		
		$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/mall/read?username="+uid+"&cateid="+cateid,
			dataType:"jsonp",
			jsonp : "jsonp_callback",
			data:"{'uid':"+uid+",'cateid':"+cateid+"}",
			timeout: 5000,
			success:function(data, status){
				
				
			  var strbystorelist="<div class=\"ch proch\"><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':1}\" cateid=\"1\" class=\"on\">专科用药</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':2}\" cateid=\"2\">营养保健</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':3}\" cateid=\"3\">医疗器械</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':4}\" cateid=\"4\">其他</a></div>";
			  
//			  var strbystorelist="111";
			  if(data!=null){
				  data=data["msg"];
				  strbystorelist+="<ul class=\"ulprolist\">";
				  var lendata;
			  	  for(i=0;lendata=data.length,i<lendata;i++){
					  
					  var picurl="img.png";
					  if(data[i]["pic"].length>0){
						  picurl=data[i]["pic"][0];
						  }
					  
				  strbystorelist+="<li><a href='#fujinyaodianproshow?upara={proid:"+data[i]["id"]+"}'><img class='pic' src='"+picurl+"'><div class='name'>"+data[i]["name"]+"<em>"+data[i]["desc"]+"</em></div><div class='jiage'>价格：<span class='num'>￥"+data[i]["price_sell"]+"</span> 规格"+data[i]["spec"]+"</div></a></li>";
				  
				  
				  }
				  strbystorelist+="</ul>";
			  }
			  else{strbystorelist="暂无数据"}
			  $("#fujinyaodianprolist .maincon").html(strbystorelist);
			  //alert($("#fujinyaodianprolist .maincon").html());
			},
			error:function(XHR, textStatus, errorThrown){
				
			   $("#fujinyaodianprolist .maincon").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
		
		
	}
})


//fujinyishengprolist
$( document ).on( "pagebeforeshow", "#fujinyishengprolist", function() {	
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var uid=jparas["uid"];		
		 var cateid=jparas["cateid"];
		
		$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/mall/read?username="+uid+"&cateid="+cateid,
			dataType:"jsonp",
			jsonp : "jsonp_callback",
			data:"{'uid':"+uid+",'cateid':"+cateid+"}",
			timeout: 5000,
			success:function(data, status){
				
				
			  var strbystorelist="<div class=\"ch proch\"><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':1}\" cateid=\"1\" class=\"on\">专科用药</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':2}\" cateid=\"2\">营养保健</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':3}\" cateid=\"3\">医疗器械</a><a href=\"#fujinyaodianprolist?upara={'uid':'','cateid':4}\" cateid=\"4\">其他</a></div>";
			  
			  if(data!=null){
				  data=data["msg"];
				  strbystorelist+="<ul class=\"ulprolist\">";
				  var lendata;
			  	  for(i=0;lendata=data.length,i<lendata;i++){
					  
					  var picurl="img.png";
					  if(data[i]["pic"].length>0){
						  picurl=data[i]["pic"][0];
						  }
					  
				  strbystorelist+="<li><a href='#fujinyaodianproshow?upara={proid:"+data[i]["id"]+"}'><img class='pic' src='"+picurl+"'><div class='name'>"+data[i]["name"]+"<em>"+data[i]["desc"]+"</em></div><div class='jiage'>价格：<span class='num'>￥"+data[i]["price_sell"]+"</span> 规格"+data[i]["spec"]+"</div></a></li>";
				  
				  
				  }
				  strbystorelist+="</ul>";
			  }
			  else{strbystorelist="暂无数据"}
			  $("#fujinyishengprolist .maincon").html(strbystorelist);
			  
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyishengprolist .maincon").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
				 
	}
})


//fujinyaodianproshow
$( document ).on( "pagebeforeshow", "#fujinyaodianproshow", function() {
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var proid=jparas["proid"];
		 var prouser=jparas["prouser"];
	$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/mall/read?username="+prouser+"&itemid="+proid,
			dataType:"jsonp",
			jsonp : "jsonp_callback",
			data:"{'itemid':"+proid+",'username':"+prouser+"}",
			timeout: 5000,
			success:function(data, status){
			  var strbystorelist="";
			  if(data!=null && 1==data["status"]){

				  data=data["msg"];
				  var picurl="img.png";
				  if(data["thumb"].length>0){picurl=data["thumb"]}
				  
				  strbystorelist+="<div class=\"proimgbox\"><img src=\""+picurl+"\" /></div><dl class=\"proparas\"><dt><h1>"+data["title"]+"<em></em></h1></dt><dd class=\"jiage\">会员价：<span class=\"num\">￥"+data["price"]+"</span></dd><dd class=\"guige\">规格："+data["spec"]+"</dd><input data-role=\"none\" value=1 type=\"hidden\" id=\"inpbynum\"><dd class=\"ddbtn\"><a href=\"#\" class=\"btntocart\">加入购物车</a> </dd></dl><div class=\"protxt\""+data["content"]+"</div>";
				  
				  $("#fujinyaodianproshow .maincon").html(strbystorelist);
				  var nowpro={id:proid,proname:data["title"],guige:data["spec"],price:data["price"],num:0,pic:picurl,url:"#fujinyaodianproshow?upara={proid:"+proid+",prouser:"+prouser+"}","prouser":prouser}
				  
				  $(".btntocart").on("click",function(){
					  console.log(nowpro);
					  
					  $.layer({
							type: 0,
							title: "添加成功！",
							area:['90%','auto'],
							closebtn:[0,true],
							time:5,
							dialog:{
								btns:2,
								btn:['去购物车','继续购物'],
								type:3,
								msg:'成功添加到购物车',
								yes:function(){
									addcart(nowpro,$("#inpbynum").val());
									window.location.href="#cart";
									layer.closeAll();
									},
								no:function(){
									layer.closeAll();
									}
								}
							});

						return false;
					  })
				  
			  }
			  else{strbystorelist="暂无数据";$("#fujinyaodianproshow .maincon").html(strbystorelist);}
			  
			  
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyaodianproshow .maincon").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
	 }
})

//cart
$( document ).on( "pagebeforeshow", "#cart", function() {

	 	
	var cartval=$.cookie("jdkcart")||"[]";
	cartval=JSON.parse(cartval);
	
	var strtd="";
	$.each(cartval,function(i,v){
		strtd+="<li><a href=\""+v.url+"\"><img src=\""+v.pic+"\"></a><div class=\"paras\"><div class=\"tit\"><a href=\""+v.url+"\">"+v.proname+"</a></div><div class=\"danprice\">￥"+v.price+"</div><div class=\"orderpronum incart\" prostr='{\"id\":\""+v.id+"\",\"proname\":\""+v.proname+"\",\"guige\":\""+v.guige+"\",\"price\":\""+v.price+"\",\"num\":\""+v.num+"\",\"pic\":\""+v.pic+"\",\"url\":\""+v.url+"\",\"prouser\":\""+v.prouser+"\"}'><span class=\"sptxt\">数量：</span><a href=\"#\">-</a><input data-role=\"none\" type=\"text\" value=\""+v.num+"\" orinum=\""+v.num+"\"><a href=\"#\">+</a></div><span class=\"thisprototprice\">￥"+(parseFloat(v.price)*parseFloat(v.num)).toFixed(2)+"</span><a href=\"#\" idmark=\""+v.id+"\" data-prouser=\""+v.prouser+"\" class=\"carttrdel\">删除</a></div></li>";
		})
	$(".sptotnum").html($.cookie("jdkcartnum"));
	$(".sptotprice").html(parseFloat($.cookie("jdkcarttotprice")).toFixed(2));
	$(".ulcart").html(strtd);
	$(".ulcart .carttrdel").on("click",function(){
		
		$(this).closest("li").remove();
		var nowid=$(this).attr("idmark");
		var prouser = $(this).attr("data-prouser");
		delcart(nowid,prouser);
		$(".sptotnum").html($.cookie("jdkcartnum"));
		$(".sptotprice").html(parseFloat($.cookie("jdkcarttotprice")).toFixed(2));			
		return false;
	}) 
	
	
	$(".orderpronum a").on("click",function(){
    	var realch=true;
    	var chnum=1;
    	var inpnum=$(this).siblings("input");
    	if($(this).html()=="-"){
    		chnum=-1;
    		if(inpnum.val()=="1"){realch=false;}
    	}
    	
    	if(realch){
    		var newnum=parseInt(inpnum.val())+chnum;
    		inpnum.val(newnum).attr("orinum",newnum);
    		if($(this).parent().hasClass("incart")){
    			var strpro=$(this).parent().attr("prostr");    		
	    		var objpro=JSON.parse(strpro);
	    		addcart(objpro,chnum);
	    		var thisprototprice=$(this).parent().siblings(".thisprototprice").html().replace('￥','');
	    		thisprototprice=parseFloat(thisprototprice)+objpro.price*chnum;
	    		$(this).parent().siblings(".thisprototprice").html('￥'+thisprototprice.toFixed(2));
	    		$(".sptotnum").html($.cookie("jdkcartnum"));
	    		$(".sptotprice").html(parseFloat($.cookie("jdkcarttotprice")).toFixed(2));
    		}		
    	}
    	return false;
    })

    $(".orderpronum input").on("change",function(){
        var nowval=$(this).val();       
        if(isNaN(nowval)){$(this).val(orival);return false;}
        if($(this).parent().hasClass("incart")){
	        var orival=$(this).attr("orinum");
	        nowval=parseInt(nowval);
	        orival=parseInt(orival);
	        var chnum=nowval-orival;
	        var strpro=$(this).parent().attr("prostr");    		
    		var objpro=JSON.parse(strpro);
    		addcart(objpro,chnum);
    		var thisprototprice=$(this).parent().siblings(".thisprototprice").html().replace('￥','');
	    	thisprototprice=parseFloat(thisprototprice)+objpro.price*chnum;
	    	$(this).parent().siblings(".thisprototprice").html('￥'+thisprototprice.toFixed(2));
    		$(".sptotnum").html($.cookie("jdkcartnum"));
	    	$(".sptotprice").html(parseFloat($.cookie("jdkcarttotprice")).toFixed(2));
    	}
    })
	 
})

//order
$( document ).on( "pagebeforeshow", "#order", function() {
	
	var cartnum=0||$.cookie("jdkcartnum");
    var carttotprice=0||$.cookie("jdkcarttotprice");
	$(".sptotnum").html(cartnum);
	$(".sptotprice").html(parseFloat(carttotprice).toFixed(2));
	
	if($.cookie("addr")==null){
			$.ajax({
				type:"GET",
				url:"http://client.jiaduokang.com/address/read/?username="+localStorage.user,
				dataType:"jsonp",
				data:{"username":localStorage.user},
				//jsonpCallback:"jdkjsonp",
				jsonp : "jsonp_callback",
				timeout: 5000,
				success:function(data, status){
				  var strbystorelist="";
				  if(data!=null){
					  data=data["msg"];
					  console.log(data);
					  if(data=="数据不存在"){
						  $(".orderaddra").html("添加收货地址").attr("href","#addredit?paras={\"act\":\"add\",\"id\":\"0\",\"come\":\"order\"}");
						  }
					  else{
						  data=data[0];
						  var addrid=data["itemid"];
						  var recname=data["truename"];
						  var rectel=data["mobile"];
						  var recaddr=data["address"];
						  var recpost=data["postcode"];
						  $.cookie("addr","{\"addrid\":\""+addrid+"\",\"recname\":\""+recname+"\",\"rectel\":\""+rectel+"\",\"recaddr\":\""+recaddr+"\",\"recpost\":\""+recpost+"\"}");
						  $(".orderaddra").html("<dl ><dt>收货人：</dt><dd>"+recname+"</dd><dt>手机：</dt><dd>"+rectel+"</dd><dt>地址：</dt><dd>"+recaddr+"</dd><dt>邮编：</dt><dd>"+recpost+"</dd></dl>").attr("href","#orderaddr")
						  }
					  
				  }
				  else{strbystorelist="暂无数据"}
				  
				},
				error:function(XHR, textStatus, errorThrown){
				   $(".orderaddra").html("网络不给力，加载未完成!")
				   console.log(textStatus+"\n"+errorThrown);
				}
			}) 	
		}
	else{
			
			var straddr=$.cookie("addr");
			straddr=JSON.parse(straddr);
			var addrid=straddr["addrid"];
		    var recname=straddr["recname"];
		    var rectel=straddr["rectel"];
		    var recaddr=straddr["recaddr"];
		    var recpost=straddr["recpost"];
			$(".orderaddra").html("<dl ><dt>收货人：</dt><dd>"+recname+"</dd><dt>手机：</dt><dd>"+rectel+"</dd><dt>地址：</dt><dd>"+recaddr+"</dd><dt>邮编：</dt><dd>"+recpost+"</dd></dl>").attr("href","#orderaddr")
		}
	
	 
})


//orderaddr
$( document ).on( "pagebeforeshow", "#orderaddr", function() {
	
	$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/address/read/?username="+localStorage.user,
			dataType:"jsonp",
			data:{"username":localStorage.user},
			//jsonpCallback:"jdkjsonp",
			jsonp : "jsonp_callback",
			timeout: 5000,
			success:function(data, status){

			  	if(data!=null&&data["status"]=="1"){
				  data=data["msg"];
				  console.log(data);
				  if(data=="数据不存在"){
					  $(".addrman").html("暂无地址");
					  }
				  else{
					  var straddrs="";
					  var cooindex=0;
					  if($.cookie("addr")!=null){cooindex=JSON.parse($.cookie("addr"))["addrid"]}
					  $.each(data,function(i,v){
						  var addrid=v["itemid"];
						  var recname=v["truename"];
						  var rectel=v["mobile"];
						  var recaddr=v["address"];
						  var recpost=v["postcode"];
					  	  straddrs+="<section addrid=\""+addrid+"\" class=\""+(cooindex==addrid?"on":"")+"\"><span class=\"recname\">"+recname+"</span> <span class=\"rectel\">"+rectel+"</span><div class=\"recaddr\"><span class=\"sprecaddr\">"+recaddr+"</span><span class=\"sprecpost\">"+recpost+"</span></div><div><a class=\"actchoo\" href=\"#\">选择该地址</a><a href='#addredit?paras={\"act\":\"edit\",\"id\":\""+addrid+"\",\"come\":\"orderaddr\"}'>编辑</a><a href=\"\" class=\"aactdel\">删除</a></div></section>";
						  })
					  $(".addrman").html(straddrs);
					  
					  $(".addrman .actchoo").on("click",function(){
						$sec=$(this).parent().parent();
						$pardiv=$(this).parent();
						var straddr="{\"addrid\":\""+$sec.attr("addrid")+"\",\"recname\":\""+$sec.find(".recname").html()+"\",\"rectel\":\""+$sec.find(".rectel").html()+"\",\"recaddr\":\""+$sec.find(".sprecaddr").html()+"\",\"recpost\":\""+$sec.find(".sprecpost").html()+"\"}";
						$.cookie("addr",straddr);
						$sec.addClass("on").siblings().removeClass("on");
						return false;
						})
					  }
					  
					  $(".addrman .aactdel").on("click",function(){
						  $sec=$(this).parent().parent();
						  var thisid=$sec.attr("addrid");
						  $.ajax({
							type:"GET",
							url:"http://client.jiaduokang.com/address/delete/?username="+localStorage.user+"&itemid="+thisid,
							dataType:"jsonp",
							//jsonpCallback:"jdkjsonp",
							jsonp : "jsonp_callback",
							timeout: 5000,
							success:function(data, status){
							  if(data!=null){
								  if($.cookie("addr")!=null&&JSON.parse($.cookie("addr"))["addrid"]==thisid){$.cookie("addr",null)}
								  $sec.remove();
								  
							  }
							  else{}
							},
							error:function(XHR, textStatus, errorThrown){
							   console.log(textStatus+"\n"+errorThrown);
							}
							
							})
						  })
				  
				}
				else{
				  	$(".addrman").html("暂无地址");
				}
			  
			},
			error:function(XHR, textStatus, errorThrown){
			   $(".orderaddra").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}
		})
	
})


//addredit
$( document ).on( "pagebeforeshow", "#addredit", function() {

	$(".sel").change(function(){
            var str=$(this).attr("str");
            ch(str,$("[str="+str+"]").index(this)+1);
    	})
	var jparas=eval("("+unescape(paras)+")");
	if("add"==jparas["act"]){
		$(".btnaddredit").unbind("click").click(function(){
			$(this).attr("disabled","");
			var recname=$("#fmaddredit [name='recname']").val().replace(/\s+/g,"");
			var recaddr=$("#fmaddredit [name='addr']").val().replace(/\s+/g,"");
			var rectel=$("#fmaddredit [name='tel']").val().replace(/\s+/g,"");
			var recpost=$("#fmaddredit [name='postcode']").val().replace(/\s+/g,"");
			if(recname.length==0||recaddr.length==0||rectel.length==0||recpost.length==0){
				showMsg("请填写完整！");$(this).removeAttr("disabled");return false;
				}
			$.ajax({
				type:"GET",
				url:"http://client.jiaduokang.com/address/add?username="+localStorage.user+"&truename="+recname+"&address="+recaddr+"&postcode="+recpost+"&mobile="+rectel,
				dataType:"jsonp",
				//jsonpCallback:"jdkjsonp",
				jsonp : "jsonp_callback",
				//data:{"username":localStorage.user,"truename":recname,"address":recaddr,"postcode":recpost,"mobile":rectel},
				timeout: 5000,
				success:function(data, status){
				  if(data!=null){
					  showMsg("添加成功！");
					  if(jparas["come"]=="order"){
					  $.cookie("addr","{\"addrid\":\""+data["msg"]+"\",\"recname\":\""+recname+"\",\"rectel\":\""+rectel+"\",\"recaddr\":\""+recaddr+"\",\"recpost\":\""+recpost+"\"}");
						}
					  $(".btnaddredit").removeAttr("disabled");
					  window.location="#"+jparas["come"];
				  }
				  else{
					  $(".btnaddredit").removeAttr("disabled");
					  }
				  
				},
				error:function(XHR, textStatus, errorThrown){
					$(".btnaddredit").removeAttr("disabled");
				   console.log(textStatus+"\n"+errorThrown);
				}
				
				})
			
			
			})
		}
	else{
		var addrid=jparas["id"];
		$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/address/read/?username="+localStorage.user+"&itemid="+addrid,
			dataType:"jsonp",
			//jsonpCallback:"jdkjsonp",
			jsonp : "jsonp_callback",
			//data:{"username":localStorage.user,"itemid":addrid},
			timeout: 5000,
			success:function(data, status){
			  if(data!=null){
				  var data=data["msg"];
				  var recname=data["truename"];
				  var recaddr=data["address"];
				  var recpost=data["postcode"];
				  var rectel=data["mobile"];
				  $("#fmaddredit [name='recname']").val(recname);
				  $("#fmaddredit [name='addr']").val(recaddr);
				  $("#fmaddredit [name='tel']").val(rectel);
				  $("#fmaddredit [name='postcode']").val(recpost);
				  
				  $(".btnaddredit").unbind("click").click(function(){
					$(this).attr("disabled","");  
					var recname=$("#fmaddredit [name='recname']").val().replace(/\s+/g,"");
					var recaddr=$("#fmaddredit [name='addr']").val().replace(/\s+/g,"");
					var rectel=$("#fmaddredit [name='tel']").val().replace(/\s+/g,"");
					var recpost=$("#fmaddredit [name='postcode']").val().replace(/\s+/g,"");
					if(recname.length==0||recaddr.length==0||rectel.length==0||recpost.length==0){
						showMsg("请填写完整！");$(this).removeAttr("disabled");return false;
						}
					$.ajax({
						type:"GET",
						url:"http://client.jiaduokang.com/address/edit/?username="+localStorage.user+"&itemid="+addrid+"&truename="+recname+"&address="+recaddr+"&postcode="+recpost+"&mobile="+rectel,
						dataType:"jsonp",
						//jsonpCallback:"jdkjsonp",
						jsonp : "jsonp_callback",
						//data:{"username":localStorage.user,"itemid":addrid,"truename":recname,"address":recaddr,"postcode":recpost,"mobile":rectel},
						timeout: 5000,
						success:function(data, status){
						  if(data!=null){
							  showMsg("修改成功！");
							  if(jparas["come"]=="order"){
					   		  $.cookie("addr","{\"addrid\":\""+addrid+"\",\"recname\":\""+recname+"\",\"rectel\":\""+rectel+"\",\"recaddr\":\""+recaddr+"\",\"recpost\":\""+recpost+"\"}");
					   			}
							  $(".btnaddredit").removeAttr("disabled");
							  
							  window.location="#"+jparas["come"];
						  }
						  else{
							  $(".btnaddredit").removeAttr("disabled");
							  }
						  
						},
						error:function(XHR, textStatus, errorThrown){
							$(".btnaddredit").removeAttr("disabled");
						   console.log(textStatus+"\n"+errorThrown);
						}
						
						})
					  
					  
					  })
			       
			  }
			  else{
				  }
			  
			},
			error:function(XHR, textStatus, errorThrown){
			   
			   console.log(textStatus+"\n"+errorThrown);
			}
					
			})
		}
	
	$(".selfir").each(function(){
        ch($(this).attr("str"),0);
        })
	 
})


//fujinyaodianyouhui
$( document ).on( "pagebeforeshow", "#fujinyaodianyouhui", function() {
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var yhid=jparas["yhid"];		
	$.ajax({
			type:"GET",
			url:"http://api.jiaduokang.com/event/show?id="+yhid,
			dataType:"jsonp",
			data:"{'yhid':yhid}",
			timeout: 5000,
			success:function(data, status){
			  var strbystorelist="";
			  if(data!=null){
				  data=data["msg"];
				  
				  strbystorelist+="<div class=\"box yaodianyhbox\"><h2>"+data["title"]+"</h2><div class=\"content\">"+data["content"]+"</div></div>"
			  }
			  else{strbystorelist="暂无数据"}
			  $("#fujinyaodianyouhui .maincon").html(strbystorelist);
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyaodianyouhui .maincon").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
	 }
})

$( document ).on( "pagebeforeshow", "#videolist", function() {
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var username=jparas["username"];	

		 jdkajp("http://client.jiaduokang.com/video/lists?username="+username,listvideo);
	
	 }
})

function listvideo(result){
	var strvlist="";
	if(1==result.status){
		result=result.msg;
		for(var i=0,len=result.length;i<len;i++){
			strvlist+="<a href='#videoshow?upara={\"itemid\":\""+result[i].itemid+"\"}'><li><h5>"+result[i]["title"]+"</h5><img src='"+result[i]["thumb"]+"'><p>"+result[i]["introduce"]+"</p><div class='paras'><span class='fl'>时间："+result[i]["startdate"].split(" ")[0]+"</span><span class='fr'>赞(188)</span></div></li></a>"
		}
		strvlist="<ul class='ulvideolist'>"+strvlist+"</ul>";
		$(".videolistcon").html(strvlist);
	}
	else{
		$(".videolist").html("暂无内容");
	}
	
}


$( document ).on( "pagebeforeshow", "#videoshow", function() {
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var itemid=jparas["itemid"];	

		 jdkajp("http://client.jiaduokang.com/video/show?itemid="+itemid,showvideo);
	
	 }
})

function showvideo(result){
	if(1==result.status){
		result=result["msg"];
		$("#videoshow .maincon").html('<div id="youkuplayer" style="width:100%;height:300px; margin:10px auto;"></div>');
		document.write("<script type='text/javascript' src='http://player.youku.com/jsapi'>"

		+"player = new YKU.Player('youkuplayer',{"

		+"styleid: '0',"

		+"client_id: 'YOUR YOUKUOPENAPI CLIENT_ID',"

		+"vid: 'XNjUwNTU4MjUy'"

		+"});"

		+"</script>")
	}
}


//fjinyisheng
$( document ).on( "pageinit", "#fujinyisheng", function() {
	$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/company/read?catid=29",
			dataType:"jsonp",
			jsonp : "jsonp_callback",
			data:"{}",
			timeout: 5000,
			success:function(data, status){
			  var strbystorelist="";
			  if(data!=null && 1== data["status"]){
				  data=data["msg"];
				  var lendata;
			  for(i=0;lendata=data.length,i<lendata;i++){

				  strbystorelist+="<li><a href='#fujinyishengshow?upara={\"username\":\""+data[i]["username"]+"\"}'><img src=\""+data[i]["thumb"]+"\" class=\"pic\"><div class=\"name\">"+data[i]["company"]+" "+data[i]["grade"]+"</div><div class=\"txt\">"+data[i]["hospital"]+" "+data[i]["department"]+"</div></a></li>"
				  }
			  }
			  else{strbystorelist="暂无数据"}
			  $("#fujinyisheng .uldoclist").html(strbystorelist);
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#fujinyisheng .uldoclist").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	

})


//fujinyishengshow
$( document ).on( "pagebeforeshow", "#fujinyishengshow", function() {	
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var doctorid=jparas["username"];
		 window.localStorage.doctorid=doctorid;
		 
		 $.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/company/read?username="+doctorid,
			dataType:"jsonp",
			data:"{'username':"+doctorid+"}",
			jsonp : "jsonp_callback",
			timeout: 5000,
			success:function(data, status){
			  strbystorelist="";
			  if(data!=null){
				  data=data["msg"];
				strbystorelist+="<div class=\"yaodianban\"><img src=\""+data["thumb"]+"\" class=\"pic\"><h1>"+data["company"]+" "+data["grade"]+"</h1></div><h3>医生简介</h3><div class=\"box syvd\"><em>科室：</em><p>"+data["hospital"]+" "+data["department"]+"</p><em>擅长：</em><p>"+data["skilled"]+" </p><em>简介：</em><p>"+data["business"]+"</p></div>"
				+"<h3>视频就医<a href=\"\" class=\"more\">查看详细&gt;&gt;</a></h3><div class=\"box syvd\"><em>主题：</em><p>科学防治肝病</p><em>简介：</em><p>雾霾和肝病雾霾和肝病雾霾和肝病雾霾和肝病雾霾和肝病雾霾和肝病雾霾和肝病雾霾和肝病</p><em>日期：</em><p>2014-02-08 09:00 ~ 18：00</p></div>"
				+"<h3>我要咨询</h3><div class=\"box docsyzxbox\"><textarea data-role=\"none\" id=\"txtyishengzx\"></textarea><input type=\"button\" id=\"btnyishengzx\" data-role=\"none\" value=\"我要咨询\"></div>"
				+"<div class=\"shopfav\"><a href=\"javascript:void(0)\">门诊患者报到</a><a href=\"#fujinyishengprolist?paras={'uid':''}\">专科用品</a><a href=\"javascript:void(0)\" class=\"fav\" id=\"afav\">关注</a></div>";

			  }
			  else{strbystorelist="数据错误"}
			  $("#fujinyishengshow .maincon").html(strbystorelist);
			  $(".fav").click(function(){actatt(window.localStorage.user, doctorid)})
			  chkattstatus(window.localStorage.user,doctorid );
			  
			  $("#fujinyishengshow #btnyishengzx").on("click",function(){
				  	$btnyishengzx=$("#fujinyishengshow #btnyishengzx");
					$btnyishengzx.val("提交中...").attr("disabled","");
					var txtyishengzx=$("#txtyishengzx").val().replace(/(^\s*)|(\s*$)/g,"");
					if(txtyishengzx.length==0){showMsg("请填写咨询内容！");return;}
					$.ajax({
						type:"GET",
						url:"http://api.jiaduokang.com/consult/add?uid="+window.localStorage.uid+"&toid="+window.localStorage.doctorid+"&content="+txtyishengzx,
						dataType:"jsonp",
						jsonp : "jsonp_callback",
						data:"{'uid':"+window.localStorage.uid+",'toid':"+window.localStorage.doctorid+",'content':"+txtyishengzx+"}",
						timeout: 5000,
						success: function(data, status){
							if(data!=null){
								showMsg(data["msg"]);
								$btnyishengzx.val("提 交").removeAttr("disabled");
								}
							else{
								showMsg("数据错误");
								$btnyishengzx.val("提 交").removeAttr("disabled");
								}
							},
						error:function(XHR, textStatus, errorThrown){
							
						   showMsg("网络错误!")
						   $btnyishengzx.val("提 交").removeAttr("disabled");
						   console.log(textStatus+"\n"+errorThrown);
						}	
						
						})
					})
			  
			},
			error:function(XHR, textStatus, errorThrown){
				
			   $("#fujinyishengshow .maincon").html("网络不给力加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
				 
	}
})



//fuwu
$( document ).on( "pagebeforeshow", "#allzxlist", function() {
	chklogined();
	var strfuwu="";

	//jdkajp("http://client.jiaduokang.com/attention/read?username="+window.localStorage.user,fnfuwu);
	jdkajp("http://client.jiaduokang.com/temp",fnfuwu);
	
	
	// $.ajax({
	// 		type:"GET",
	// 		url:"http://api.jiaduokang.com/attention/lists?uid="+window.localStorage.uid+"&target=doctor",
	// 		dataType:"jsonp",
	// 		data:"{'uid':"+window.localStorage.user+",'target':'doctor'}",
	// 		timeout: 5000,
	// 		success:function(data, status){
	// 		  if(data!=null){
	// 			  data=data["msg"];
	// 			  var lendata;
	// 		  for(i=0;lendata=data.length,i<lendata;i++){
	// 			  strfuwu+="<li><a href=\"fujin.html#fujinyishengshow?upara={'doctorid':"+data[i]["uid"]+"}\"><img src=\""+data[i]["avatar"]+"\" class=\"pic\"><div class=\"name\">"+data[i]["name"]+" "+data[i]["grade"]+"</div><div class=\"txt\">"+data[i]["hospital"]+" "+data[i]["department1"]+"</div></a></li>";
	// 			  }
	// 		  }
	// 		  else{strfuwu=""}
			  
	// 		},
	// 		error:function(XHR, textStatus, errorThrown){
	// 		   console.log(textStatus+"\n"+errorThrown);
	// 		}		
	// 	})	
	
	// $.ajax({
	// 		type:"GET",
	// 		url:"http://api.jiaduokang.com/attention/lists?uid="+window.localStorage.uid+"&target=drugstore",
	// 		dataType:"jsonp",
	// 		data:"{'uid':"+window.localStorage.user+",'target':'store'}",
	// 		timeout: 5000,
	// 		success:function(data, status){
			  
	// 		  if(data!=null){
	// 			  data=data["msg"];
	// 			  var lendata;
	// 		  for(i=0;lendata=data.length,i<lendata;i++){

	// 			  strfuwu+="<li><a href=\"fujin.html#fujinyaodianshow?upara={'bystoreid':"+data[i]["id"]+"}\"><img src=\"images/img.png\" class=\"pic\"><div class=\"name\">"+data[i]["name"]+" </div><div class=\"txt\">"+data[i]["address"]+"</div></a></li>";
	// 			  }
	// 		  }
	// 		  else{}
	// 		  $("#fuwu #ulfuwustore").html(strfuwu);
	// 		},
	// 		error:function(XHR, textStatus, errorThrown){
	// 		   //$("#fujinyisheng #ulfuwustore").html("网络不给力，加载未完成!")
	// 		   console.log(textStatus+"\n"+errorThrown);
	// 		}		
	// 	})	

})

function fnfuwu(result){
	if(1==result["status"]){
		var strfuwu="";
		result=result.msg.msg;
		for(i=0;lendata=result.length,i<lendata;i++){
		  strfuwu+="<li><a href='#fujinyishengshow?upara={\"username\":\""+result[i]["username"]+"\"}'><img class='pic' src='"+result[i]["thumb"]+"'>"
		  +"<div class=\"name\">"+result[i]["company"]+" <div class='acttxt'>发布了一个新视频就医</div></div><div class='con'><img class='conpic' src='"+result[i]["vthumb"]+"'><div class='contxt'>"+result[i]["vtit"]+"<br>"+result[i]["vcon"]+"</div></div></a></li>";
		}
		$("#allzxlist #ulfuwustore").html(strfuwu);
	}
}

//直播列表
$( document ).on( "pagebeforeshow", "#mylive", function() {
	chklogined();
	var strlivelist="";

	$.ajax({
			type:"GET",
			url:"http://client.jiaduokang.com/video/lists?username="+window.localStorage.user,
			dataType:"jsonp",
			//jsonpCallback:"jdkjsonp",
			jsonp : "jsonp_callback",
			data:"{'username':"+window.localStorage.user+"}",
			timeout: 5000,
			success:function(result, status){
			  
			  if(result!=null&&1==result.status){
				  result=result["msg"];
				  var lenresult;
				  for(i=0;lenresult=result.length,i<lenresult;i++){

					  strlivelist+="<li><h5>"+result[i]["title"]+"</h5><p>"+result[i]["startdate"]+"</p><i><input type=\"button\" onclick=\"window.js2java.toRecord('"+window.localStorage.user+"|"+result[i]["itemid"]+"')\" data-role=\"none\" value=\"进入直播\" /></i></li>";
				  }
			  }
			  else{strlivelist="暂无记录"}
			  $("#mylivelist").html(strlivelist);
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#mylivelist").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	

})

//聊天列表
$(document).on("pagebeforeshow","#talklist",function(){
	jdkajp("http://client.jiaduokang.com/chat/read?username="+window.localStorage.user,fntalklist);

})
function fntalklist(result){
	if(1== result["status"]){
		result=result.msg;
		var str="";
		var resnow=result;
		
		for(var i=0,len=resnow.length;i<len;i++){			
			str+="<li><a href='#talkshow?paras={\"talkid\":\""+resnow[i]["chatid"]+"\"}'><img src=\"img.png\" class=\"pic\" ><div class=\"name\">"+resnow[i]["from"]+"</div>"
					+"<div class=\"txt\">"+resnow[i]["lastword"]+"</div></a></li>";
		}
		
		$("#talklist .uldoclist").html(str);
	}
}


//聊天详细
$(document).on("pagebeforeshow","#talkshow",function(){
	if(paras.length>0){
		var jparas=eval("("+unescape(paras)+")");
		var talkid=jparas["talkid"];	
		jdkajp("http://client.jiaduokang.com/chat/read?chatid="+talkid+"&username="+window.localStorage.user,fntalkshow);
	}
})

$(document).on("pagehide","#talkshow",function(){

	clearTimeout(talktimer);
})

function fntalkshow(result){
	if(1== result["status"]){
		result=result.msg;
		var uid=window.localStorage.user;
		var jparas=eval("("+unescape(paras)+")");
			var talkid=jparas["talkid"];
		var str="";
		for(var i=0,len=result.length;i<len;i++){
			var strself=result[i]["self"];
			var strname=result[i]["name"];
			var strword=result[i]["word"];
			var strtime=result[i]["time"];
			var strclass=1==strself?"right":"left";
			str+="<li class=\""+strclass+"td\"><em>"+strname+"</em><div class=\""+strclass+" txt\">"+strword+"</div></li>"
		}
		
		$("#talkshow .ulzxshow").html(str);
		talktimer=setTimeout(_refreshtalk(talkid),3000);

		$("#talkshow .docsyzxbox").html("<textarea data-role=\"none\" id=\"txtyishengzx\"></textarea><input type=\"button\" id=\"btnyishengzx\" data-role=\"none\" value=\"提 交\">");
			  
		$("#talkshow #btnyishengzx").on("click",function(){
			var jparas=eval("("+unescape(paras)+")");
			var talkid=jparas["talkid"];
		    $btnyishengzx=$("#talkshow #btnyishengzx");
			$btnyishengzx.val("提交中...").attr("disabled","");
			var txtyishengzx=$("#txtyishengzx").val().replace(/(^\s*)|(\s*$)/g,"");
			if(txtyishengzx.length==0){showMsg("请填写咨询内容！");return;}
			$.ajax({
				type:"GET",
				url:"http://client.jiaduokang.com/chat/add?username="+uid+"&chatid="+talkid+"&word="+txtyishengzx,
				dataType:"jsonp",
				jsonp : "jsonp_callback",
				data:"{'uid':"+uid+",'chatid':"+talkid+",'word':"+txtyishengzx+"}",
				timeout: 5000,
				success: function(data, status){
					if(data!=null){
						
						$btnyishengzx.val("提 交").removeAttr("disabled");
						$("#talkshow #ulzxshow").append("<li class=\"righttd\"><em>我</em><div class=\"txt right\">"+txtyishengzx+"</div></li>");
						}
					else{
						showMsg("数据错误");
						$btnyishengzx.val("提 交").removeAttr("disabled");
						}
					},
				error:function(XHR, textStatus, errorThrown){
					
				   showMsg("网络错误!")
				   $btnyishengzx.val("提 交").removeAttr("disabled");
				   console.log(textStatus+"\n"+errorThrown);
				}	
				
				})
			})
	}
}

//刷新聊天列表
function refreshtalk(talkid){
	$.ajax({
		type:"GET",
		url:"http://client.jiaduokang.com/chat/read?chatid="+talkid+"&username="+window.localStorage.user,
		dataType:"jsonp",
		jsonp : "jsonp_callback",
		data:"{}",
		timeout: 5000,
		success: function(result){
			if(1== result["status"]){
				result=result.msg;
				var str="";
				for(var i=0,len=result.length;i<len;i++){
					var strself=result[i]["self"];
					var strname=result[i]["name"];
					var strword=result[i]["word"];
					var strtime=result[i]["time"];
					var strclass=1==strself?"right":"left";
					str+="<li class=\""+strclass+"td\"><em>"+strname+"</em><div class=\""+strclass+" txt\">"+strword+"</div></li>"
				}
				
				$("#talkshow .ulzxshow").html(str);
				talktimer=setTimeout(_refreshtalk(talkid),3000);
			}
		}

	})
}


function _refreshtalk(talkid){
	return function(){
		refreshtalk(talkid);
	}
}





//咨询总列表
$( document ).on( "pagebeforeshow", "#msg", function() {
	
	chklogined();
	// var strzx="";

	
	// $.ajax({
	// 		type:"GET",
	// 		url:"http://client.jiaduokang.com/msg/add?username="+window.localStorage.uid,
	// 		dataType:"jsonp",
	// 		//jsonpCallback:"jdkjsonp",
	// 		jsonp : "jsonp_callback",
	// 		data:"{'uid':"+window.localStorage.user+"}",
	// 		timeout: 5000,
	// 		success:function(data, status){
			  
	// 		  if(data!=null&&1==data.status){
	// 			  data=data["msg"];
	// 			  var lendata;
	// 			  for(i=0;lendata=data.length,i<lendata;i++){

	// 				  strzx+="<li><a href=\"#zxshow?paras={uid:"+window.localStorage.uid+",toid:"+data[i]["toid"]+"}\"><img src=\"images/male.png\" class=\"pic\"><div class=\"name\">"+data[i]["toid_username"]+"</div><div class=\"txt\">"+data[i]["content"]+"</div></a><span class=\"time\">"+data[i]["create_date"]+"</span></li>";
	// 			  }
	// 		  }
	// 		  else{strzx="暂无记录"}
	// 		  $("#allzxlist #ulallzx").html(strzx);
	// 		},
	// 		error:function(XHR, textStatus, errorThrown){
	// 		   $("#allzxlist #ulallzx").html("网络不给力，加载未完成!")
	// 		   console.log(textStatus+"\n"+errorThrown);
	// 		}		
	// 	})	
	$("#msg .maincon").html("<ul class=\"ulallzx\"></ul><ul class=\"ulletterlist\"><li class=\"myloader\"></li></ul>")
	jdkajp("http://client.jiaduokang.com/message/read?username="+window.localStorage.user+"&isread=",letterlist);

})

$( document ).on( "pagebeforeshow", "#lettershow", function() {
	if(paras.length>0){
		var jparas=eval("("+unescape(paras)+")");
		var username=jparas["username"];	
		var itemid=jparas["itemid"];
		jdkajp("http://client.jiaduokang.com/message/read?username="+username+"&itemid="+itemid,fnlettershow);

	}
})

function letterlist(result){
	if(1== result["status"]){
		result=result.msg;
		var str="";
		for(var i=0,len=result.length;i<len;i++){
			str+="<li><a href='#lettershow?paras={\"itemid\":\""+result[i]["itemid"]+"\",\"username\":\""+window.localStorage.user+"\"}'>"
			+"<h5><img src=\"lettericon.png\">"+result[i]["title"]+"</h5><div class=\"name\">"+result[i]["fromcompany"]+"</div><div class=\"contxt\">"+limitstr(removeHTMLTag(result[i]["content"]),30)+"...</div></a><span class=\"time\">"+getLocalTime(result[i]["addtime"])+"</span></li>"
		}
		$("#msg .ulletterlist").html(str);
	}
}

function getLocalTime(nS) {     
   return new Date(parseInt(nS) * 1000).toLocaleString().replace(/年|月|\//g, "-").replace(/日/g, " ");      
}
function removeHTMLTag(str) {
    str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
    str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
    //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
    str=str.replace(/&nbsp;/ig,'');//去掉&nbsp;
    return str;
}
function limitstr(str,len){
	return str.substring(0,str.length>len?len:str.length);
}  

function fnlettershow(result){
	if(1== result["status"]){
		result=result.msg;
		var str="<h5>"+result["title"]+"</h5><p>发件人："+result["fromcompany"]+"</p><p>"+getLocalTime(result["addtime"])+"</p><article>"+result["content"]+"</article>"
				+"<textarea></textarea> <div><input type=\"button\" class=\"btn btnletterreply\" value=\"回复\" ></div>"
		$(".lettershowbox").html(str);
		$(".btnletterreply").click(function(){showMsg("回复成功!")})
	}
}   


//zxshow
$( document ).on( "pagebeforeshow", "#zxshow", function() {
	 if(paras.length>0){
		 var jparas=eval("("+unescape(paras)+")");
		 var uid=jparas["uid"];	
		 var toid=jparas["toid"]	
	$.ajax({
			type:"GET",
			url:"http://api.jiaduokang.com/consult/lists?uid="+uid+"&toid="+toid,
			dataType:"jsonp",
			data:"{'uid':"+uid+",'toid':"+toid+"}",
			timeout: 5000,
			success:function(data, status){
			  var strbystorelist="";
			  if(data!=null){
				  data=data["msg"];
				  var lendata;
			      for(i=0;lendata=data.length,i<lendata;i++){
				  var datauid=data[i]["uid"];
				  var rolename="";
				  var roleclass="left";
				  if(uid==datauid){rolename="我";}else{rolename=data[i]["uid_username"];roleclass="right";}
				  strbystorelist+="<li class=\""+roleclass+"td\"><em>"+rolename+"</em><div class=\"txt "+roleclass+"\">"+data[i]["content"]+"</div></li>";
				  }
			  }
			  else{strbystorelist="暂无数据"}
			  
			  $("#zxshow #ulzxshow").html(strbystorelist);
			  $("#zxshow .docsyzxbox").html("<textarea data-role=\"none\" id=\"txtyishengzx\"></textarea><input type=\"button\" id=\"btnyishengzx\" data-role=\"none\" value=\"我要咨询\">");
			  
			  $("#zxshow #btnyishengzx").on("click",function(){
				    $btnyishengzx=$("#zxshow #btnyishengzx");
					$btnyishengzx.val("提交中...").attr("disabled","");
					var txtyishengzx=$("#txtyishengzx").val().replace(/(^\s*)|(\s*$)/g,"");
					if(txtyishengzx.length==0){showMsg("请填写咨询内容！");return;}
					$.ajax({
						type:"GET",
						url:"http://api.jiaduokang.com/consult/add?uid="+uid+"&toid="+toid+"&content="+txtyishengzx,
						dataType:"jsonp",
						data:"{'uid':"+uid+",'toid':"+toid+",'content':"+txtyishengzx+"}",
						timeout: 5000,
						success: function(data, status){
							if(data!=null){
								showMsg(data["msg"]);
								$btnyishengzx.val("提 交").removeAttr("disabled");
								$("#zxshow #ulzxshow").append("<li class=\"lefttd\"><em>我</em><div class=\"txt left\">"+txtyishengzx+"</div></li>");
								}
							else{
								showMsg("数据错误");
								$btnyishengzx.val("提 交").removeAttr("disabled");
								}
							},
						error:function(XHR, textStatus, errorThrown){
							
						   showMsg("网络错误!")
						   $btnyishengzx.val("提 交").removeAttr("disabled");
						   console.log(textStatus+"\n"+errorThrown);
						}	
						
						})
				  })
			},
			error:function(XHR, textStatus, errorThrown){
			   $("#zxshow #ulzxshow").html("网络不给力，加载未完成!")
			   console.log(textStatus+"\n"+errorThrown);
			}		
		})	
	 }
})


function ch(str,deep){
	var $sel=$("[str="+str+"]");
	if($sel.length==deep)return ;
	var strjson=str;
	for(var i=0;i<deep;i++){
		strjson+=("_"+($sel.eq(i).find("option").index($sel.eq(i).find("option:selected"))-1));
		}
	
	$sel.eq(deep).find("option:gt(0)").remove();
	var def=$sel.eq(deep).attr("def");
	var v=chjson[strjson];
	for(var i=0;i<v.length;i++){
		if(def==v[i]){
				$sel.eq(deep).append("<option value=\""+v[i]+"\" selected>"+v[i]+"</option>")
			}
			else{
				$sel.eq(deep).append("<option value=\""+v[i]+"\">"+v[i]+"</option>")
				}
		
		}
	if($sel.eq(deep).find("option").index($sel.eq(deep).find("option:selected"))>0){
		ch(str,deep+1)
	}
}



//我的
$( document ).on( "pageinit", "#wode", function() {
	chklogined();

	$("#alogout").on("click",function(){
		if(confirm("退出该账号吗?")){
			window.localStorage.user="";
			window.localStorage.uid="";
			window.localStorage.company="";
			window.localStorage.islogin=false;
			window.location.href="login.html";
			}
		})

	$("#menudatatree").click(function(){
		showMsg("暂无数据!");
		return false;
	})
})

$(document).on("pagebeforeshow","#wode",function(){

	$(".ulmy .info .uname").html(window.localStorage.company);
})


$(document).on('pagebeforechange',function(e,data){  
    if (typeof data.toPage !== "string"){  
        return;  
    }  
	
	strurl=data.toPage;
	if(strurl.indexOf("?")>0)
		{paras=strurl.substr(strurl.indexOf("=") + 1)}
	else{paras={}}
	 
});  


//================================
//chkattstatus =>
//================================
function chkattstatus(fruser,touser){
	jdkajp("http://client.jiaduokang.com/attention/read?fromusername="+fruser+"&tousername="+touser,showattstatus);
}
function showattstatus(result){
	if(1==result["status"]){
		$(".fav").html("已关注").unbind("click").click(function(){showMsg("已关注")})
	}
	else{
		$(".fav").html("关注");
	}
}

function actatt(fruser, touser){
	jdkajp("http://client.jiaduokang.com/attention/add?fromusername="+fruser+"&tousername="+touser,attres);
}
function attres(result){
	if(1 == result["status"]){
		showMsg("关注成功!")
		$(".fav").html("已关注").unbind("click").click(function(){
			showMsg("已关注!");
		});
	}
}


//===============================
//通用ajax请求
//url:ajax请求地址; fnsuc:成功后执行的方法; restype:返回数据方式-json或string等
//reqtype: post或get ; paras:参数 ; fnerr: 出错后执行的
//===============================
// function hajax(url,fnsuc,restype,reqtype,paras,fnerr){
// 	$.ajax({
// 		type : reqtype || "GET",
// 		url : url,
// 		dataType : restype || "json",
// 		data : paras,
// 		timeout : 5000,
// 		success : fnsuc
// 	})
// }

function jdkajp(url,fnsuc,reqtype,paras,fnerr){
	$.ajax({
		type : reqtype || "GET",
		url : url,
		dataType : "jsonp",
		jsonp : "jsonp_callback",
		data : paras || "",
		timeout : 5000,
		success : function(result){
			console.log(typeof(fnsuc)+JSON.stringify(result));
			if(typeof(fnsuc)=="function"){
				fnsuc(result);
			}
			else{
				console.log("success!");
			}
		},
		error:function(XHR, textStatus, errorThrown){
			if(typeof(fnerr)=="function"){
				fnerr(textStatus);
			}	
			else{
				showMsg("网络错误!");
		    	console.log(textStatus+"\n"+errorThrown);
			}						
		   
		}	
	})
}



function addcart(objpro,opnum,prouser){
    var cartval=$.cookie("jdkcart")||"[]";
    var cartnum=$.cookie("jdkcartnum")||0;
    var carttotprice=$.cookie("jdkcarttotprice")||0;
	console.log(cartnum);
	console.log(carttotprice);
    cartnum=parseInt(cartnum);
    carttotprice=parseFloat(carttotprice);
    
    cartval=JSON.parse(cartval);
    var realadd=true;
    for(var i=0,cartlen=cartval.length;i<cartlen;i++){
        
        var temppro=cartval[i];
        if(temppro.id==objpro.id && temppro.prouser==objpro.prouser){
            realadd=false;
            cartval[i].num=parseInt(cartval[i].num)+parseInt(opnum);
            }
        }
    if(realadd){objpro.num=opnum;cartval.push(objpro)}
    
    cartnum+=parseInt(opnum);
    carttotprice+=parseFloat(objpro.price)*parseInt(opnum);
    
    console.log(JSON.stringify(cartval));
    $.cookie("jdkcart",JSON.stringify(cartval),{expires:30,path:"/"});
    $.cookie("jdkcartnum",cartnum,{expires:30,path:"/"});
    $.cookie("jdkcarttotprice",carttotprice,{expires:30,path:"/"});
}


function delcart(proid,prouser){
	var cartval=$.cookie("jdkcart")||"[]";
	var cartnum=$.cookie("jdkcartnum")||0;
    var carttotprice=$.cookie("jdkcarttotprice")||0;
	cartval=JSON.parse(cartval);
	var nowindex=-1;
	$.each(cartval,function(i,v){
		if(v.id==proid && v.prouser==prouser){nowindex=i}			
		})
	if(nowindex>-1){
		cartnum=parseInt(cartnum)-cartval[nowindex].num;
		carttotprice=parseFloat(carttotprice)-parseInt(cartval[nowindex].num)*parseFloat(cartval[nowindex].price);
		cartval.splice(nowindex,1)

	}	
	$.cookie("jdkcart",JSON.stringify(cartval),{expires:30,path:"/"});
	$.cookie("jdkcartnum",cartnum,{expires:30,path:"/"});
    $.cookie("jdkcarttotprice",carttotprice,{expires:30,path:"/"});

}



//显示加载器  
function showLoader() {  

    //显示加载器.for jQuery Mobile 1.2.0  
    $.mobile.loading('show', {  
        text: '加载中...', //加载器中显示的文字  
        textVisible: true, //是否显示文字  
        theme: 'a',        //加载器主题样式a-e  
        textonly: false,   //是否只显示文字  
        html: ""           //要显示的html内容，如图片等  
    });  
}  

//隐藏加载器.for jQuery Mobile 1.2.0  
function hideLoader()  
{  
    //隐藏加载器  
    $.mobile.loading('hide');  
}  
